﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Billing
{
    public class NumberToGeoString
    {

        private static string geoNumber0;
        private static string[] geoNumber10;
        private static string[] geoNumber20;
        private static string[] geoNumber100;
        private static string[] geoNumber1000;
        private static string geoNumberSuffix;
        private static string geoNumberUnion;

        public static string NumToGeo(decimal Amount, bool Hide1, bool CashFormat)
        {
            return NumToGeo(Amount, Hide1, CashFormat, "GEL");
        }

        public static string NumToGeo(decimal Amount, bool Hide1, bool CashFormat, string Currency)
        {
            //global::Billing.Shared.Properties.Settings sett = global::Billing.Shared.Properties.Settings.Default;

            //int n = (int)Amount;
            //if (geoNumber0 == null || geoNumber0 == "")
            //{
            //    geoNumber0 = sett.GEONumber0;
            //    geoNumber10 = sett.GEONumber10.Split(new char[] { Convert.ToChar(",") });
            //    geoNumber20 = sett.GEONumber20.Split(new char[] { Convert.ToChar(",") });
            //    geoNumber100 = sett.GEONumber100.Split(new char[] { Convert.ToChar(",") });
            //    geoNumber1000 = sett.GEONumber1000.Split(new char[] { Convert.ToChar(",") });
            //    geoNumberSuffix = sett.GEONumberSuffix;
            //    geoNumberUnion = sett.GEONumberUnion;
            //}
            //// '-
            //int x, y, z, w;
            //string v;
            ////'-
            //y = 1;
            //z = 0;

            //while ((n / y) > 0)
            //{
            //    z = z + 1;
            //    y = y * 1000;
            //}
            //v = "";
            //while (z > 0)
            //{
            //    do
            //    {
            //        z = z - 1;
            //        y = y / 1000;
            //        x = n / y;
            //        n = n % y;
            //    } while (!((x > 0) || (z == 0)));

            //    // '-100
            //    w = x / 100;
            //    if (w > 0)
            //    {
            //        v = v + geoNumber100[w - 1];
            //        x = x % 100;
            //        if (x == 0)
            //            v = v + geoNumberSuffix;
            //    }
            //    // '-20
            //    w = x / 20;
            //    if (w > 0)
            //    {
            //        v = v + geoNumber20[w - 1];
            //        x = x % 20;
            //        if (x == 0)
            //            v = v + geoNumberSuffix;
            //        else
            //            v = v + geoNumberUnion;
            //    }
            //    // '-
            //    w = x;
            //    if ((w > 0) && (!Hide1 || w > 1 || (w == 1 && z == 0)))
            //        if (w > 0)
            //            v = v + geoNumber10[w - 1];

            //    // '-
            //    w = z;
            //    if (w > 0)
            //    {
            //        if (!(v == "" || v.Substring(v.Length - 1, 1) == " "))
            //            v = v + " " + geoNumber1000[w - 1];
            //        if (n > 0)
            //            v = v + " ";
            //        else
            //            v = v + geoNumberSuffix;
            //    }
            //}
            //if (v == "")
            //    v = geoNumber0;
            //if (CashFormat)
            //{
            //    string Tetri = ((Amount % 1) * 100).ToString("00");
            //    if (Currency == "GEL")
            //    {
            //        v = v + " " + sett.GEOLari + " " + sett.GEONumberUnion + " " + Tetri + " " + sett.GEOTetri;
            //    }
            //    else if (Currency == "USD")
            //    {
            //        v = v + " " + sett.GEOUSD + " " + sett.GEONumberUnion + " " + Tetri + " " + sett.GEOCent;
            //    }
            //    else if (Currency == "EUR")
            //    {
            //        v = v + " " + sett.GEOEUR + " " + sett.GEONumberUnion + " " + Tetri + " " + sett.GEOEuroCent;
            //    }
            //}


            //return v;
            return String.Empty;
        }
    }
}
